package com.linjiang;

import com.linjiang.service.MyService;
import com.linjiang.service.UserService;
import com.linjiang.spring.AppConfig;
import com.linjiang.spring.LinJiangApplicationContext;

public class Test {
    public static void main(String[] args) {
        LinJiangApplicationContext context = new LinJiangApplicationContext(AppConfig.class);
        MyService service = (MyService) context.getBean("service"); // map <beanName, bean对象>
        MyService service2 = (MyService) context.getBean("service"); // map <beanName, bean对象>
        System.out.println(service.equals(service2));//判断是单例还是原型
        service.doSomeThing();

        //获取到的是代理对象
        UserService userService = (UserService) context.getBean("userService");
        System.out.println(userService);
        userService.doSomeThing();
    }
}
